//
//  ViewController3.m
//  东信
//
//  Created by love on 14-7-30.
//  Copyright (c) 2014年 DXin. All rights reserved.
//

#import "ViewController3.h"

@interface ViewController3 ()

@end

@implementation ViewController3
@synthesize dic = _dic;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }
    NSString* titlew = [_dic objectForKey:@"Title"];
   [self addTitleviewWithTitle:titlew];
    self.view.backgroundColor =[UIColor whiteColor];
    UIButton *bbtn =[UIButton buttonWithType:UIButtonTypeRoundedRect];
    bbtn.frame =CGRectMake(0, 0, 40, 30);
    [bbtn setTitle:@"<返回" forState:UIControlStateNormal];
    [bbtn setTintColor:[UIColor blackColor]];
    [bbtn addTarget:self action:@selector(bbiClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bbtn];
    UIBarButtonItem *right =[[UIBarButtonItem alloc]initWithCustomView:bbtn];
    self.navigationItem.leftBarButtonItem =right;    // Do any additional setup after loading the view.
    UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, self.view.frame.size.height-64)];
    NSURLRequest* req = [NSURLRequest requestWithURL:[NSURL URLWithString:[_dic objectForKey:@"Url"]]];
    [self.view addSubview:webView];
    [webView loadRequest:req];
}
//根据标题，设置titleView
-(void)addTitleviewWithTitle:(NSString *)title
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,150,30)];
    label.text = title;
    label.backgroundColor =[UIColor clearColor];
    NSLog(@"title--%@",title);
    label.textAlignment = NSTextAlignmentCenter;
    label.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:15];
    //label.textColor = [UIColor colorWithRed:230/255.f green:260/255.f blue:130/255.f alpha:1];
    self.navigationItem.titleView = label;
}
-(void)bbiClick
{
    [self dismissModalViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
